import { FC } from "react";
import { Picker } from "@tarojs/components";
import { FilterItem, genderData } from "@/constants/data";
interface Props {
  onConfirm?: (value: FilterItem) => void;
}

const GenderPicker: FC<Props> = ({ children, onConfirm }) => {
  const onSelected = (value) => {
    onConfirm && onConfirm(genderData[value]);
  };
  return (
    <Picker
      mode="selector"
      rangeKey="label"
      range={genderData}
      onChange={(e) => onSelected(e.detail.value)}
    >
      {children}
    </Picker>
  );
};

export default GenderPicker;
